package com.css.fghs.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.css.constant.Result;
import com.css.fghs.entity.dto.XxtxReqDTO;
import com.css.fghs.entity.vo.XxtxVO;
import com.css.fghs.service.FgjyYhzxXxtxbService;
import com.css.session.SessionUtils;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@Tag(name = "消息提醒")
@RestController
@RequestMapping("/xxtx")
@Validated
public class XxtxController {

    @Resource
    private FgjyYhzxXxtxbService xxtxService;

    @GetMapping("/getXxtx")
    @ApiOperation(value = "获取消息提醒")
    public Result<List<XxtxVO>> getXxtx(){
        String yhuuid = SessionUtils.getYhuuid();
        return Result.success(xxtxService.getXxtx(yhuuid));
    }

    @PostMapping("/getXxtxPage")
    @ApiOperation(value = "获取消息提醒")
    public Result<Page<XxtxVO>> getXxtxPage(@RequestBody XxtxReqDTO reqVO){
        String yhuuid = SessionUtils.getYhuuid();
        reqVO.setYhuuid(yhuuid);
        return Result.success(xxtxService.getXxtxPage(reqVO));
    }

}
